import ImportData from "./import/index.vue";
export default {
  components: {
    ImportData,
  },
  data() {
    return {
      searchItem: {
        searchKey: "",
      },
      add: false,
      styles: {
        height: "calc(100% - 55px)",
        overflow: "auto",
        paddingBottom: "53px",
        position: "static",
      },
      formData: {},
      success: false,
      columns: [
        {
          title: "字典ID",
          key: "codeId",
          fixed: "left",
          width: 150,
        },
        {
          title: "字典名称",
          key: "title",
          fixed: "left",
          width: 250,
        },
        {
          title: "字典简称",
          key: "shortName",
        },
        {
          title: "字典类型",
          key: "type",
        },
      ],
      count: 0,
      total: 0,
      page: 1,
      pageSize: 10,
      datalist: [],
      showImport: false,
    };
  },
  computed: {
    user() {
      return this.$store.state.user;
    },
  },
  methods: {
    menuClick(name) {
      if (name == "loginOut") {
        var that = this;
        this.$Modal.confirm({
          title: "退出",
          content: "确认退出当前账户么?",
          onOk: function () {
            var VIRTUAL_PATH = process.env.VUE_APP_VIRTUAL_PATH;
            that.$router.push(`${VIRTUAL_PATH}/login?isExit=true`);
          },
        });
      }
    },

    pageChange(page) {
      this.page = page;
      this.getData();
    },
    pageSizeChange(pageSize) {
      this.pageSize = pageSize;
      this.getData();
    },
    getData() {
      this.$axios({
        url: `/dict/list?type=${this.searchItem.searchKey}`,
        method: "POST",
        data: {
          page: this.page,
          pageSize: this.pageSize,
        },
      }).then((res) => {
        if (res.code == 200) {
          this.datalist = res.data.list;
          this.total = res.data.total;
        }
      });
    },
  },
  created() {
    this.getData();
  },
};
